using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.IO;
using System.Net;
namespace Test {
	class TcpCli {
		static void MainX() {



			string frame="0000000000000";
			IPEndPoint server=new IPEndPoint(Dns.GetHostAddresses("pon-wprf04-cl02")[0],20000);
			using(UdpClient client=new UdpClient())
			{
				int ret=client.Send(GetBytes(frame),frame.Length,server);
				IPEndPoint who=new IPEndPoint(IPAddress.Any,0);
				Byte[] receiveBytes=client.Receive(ref who);
				string strret=Encoding.Default.GetString(receiveBytes);
			}
			//using(NetworkStream stream=client.GetStream())
			//using(StreamReader reader=new StreamReader(stream))
			//using(StreamWriter writer=new StreamWriter(stream))
			//{
			//  writer.AutoFlush=true;
			//  foreach(string lineToSend in linesToSend)
			//  {
			//    Console.WriteLine("Sending to server: {0}",lineToSend);
			//    writer.WriteLine(lineToSend);
			//    string lineWeRead=reader.ReadLine();
			//    Console.WriteLine("Received from server: {0}",lineWeRead);
			//  }
			//  Console.WriteLine("Client is disconnecting from server");
			//}
		}

		static byte[] GetBytes(string str) {
			byte[] bytes=new byte[str.Length*sizeof(char)];
			System.Buffer.BlockCopy(str.ToCharArray(),0,bytes,0,bytes.Length);
			return bytes;
		}

		static string GetString(byte[] bytes) {
			char[] chars=new char[bytes.Length/sizeof(char)];
			System.Buffer.BlockCopy(bytes,0,chars,0,bytes.Length);
			return new string(chars);
		}
	}
}
